<script src="__STATIC_LIB__echarts/build/dist/echarts.js"></script>
<div class="layadmin-tabsbody-item layui-show">

    <div class="layui-row layui-col-space15">
            <div class="layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-header">
                        <i class="iconfont icon-caozuo"></i>快捷操作
                    </div>
                    <div class="layui-card-body">
                        <div class="layui-carousel layadmin-carousel layadmin-shortcut">
                            <ul class="layui-row layui-col-space10 layui-this"> 
                                <li class="layui-col-xs3">
                                    <a href="javascript:;" lay-href="{:url('user/index')}">
                                        <i class="iconfont icon-user"></i>
                                        <cite>用户管理</cite>
                                    </a>
                                </li> 
                                <li class="layui-col-xs3">
                                    <a href="javascript:;" lay-href="{:url('notice/index')}">
                                        <i class="iconfont icon-gonggao"></i>
                                        <cite>公告</cite>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-header">
                        <i class="iconfont icon-daiban"></i>待办事项
                    </div>
                    <div class="layui-card-body">
                        <div class="layui-carousel layadmin-carousel layadmin-backlog">
                            <ul class="layui-row layui-col-space10 layui-this">
                                <li class="layui-col-xs6">
                                    <a href="javascript:;" lay-href="{:url('student/index')}" lay-text="学生信息管理" class="layadmin-backlog-body">
                                        <h3>无辅导员信息</h3>
                                        <p><cite>{$wfdyxy_count}</cite></p>
                                    </a>
                                </li>
                                <li class="layui-col-xs6">
                                    <a href="javascript:;" lay-href="{:url('student/index')}" lay-text="学生信息管理" class="layadmin-backlog-body">
                                        <h3>班级变更待同步</h3>
                                        <p><cite>{$bjbgdtb_count}</cite></p>
                                    </a>
                                </li>
                                <li class="layui-col-xs6">
                                    <a href="javascript:;" lay-href="{:url('plan_student_rel/index')}" lay-text="组织架构关联" class="layadmin-backlog-body">
                                        <h3>待关联计划</h3>
                                        <p><cite>{$dgljh_count}</cite></p>
                                    </a>
                                </li>
                                <li class="layui-col-xs6">
                                    <a href="javascript:;" lay-href="{:url('plan_student_rel/index')}" lay-text="组织架构关联" class="layadmin-backlog-body">
                                        <h3>待关联财务班级</h3>
                                        <p><cite>{$dglcwbj_count}</cite></p>
                                    </a>
                                </li>
                            </ul>
                        </div>
                    </div>
                </div>
            </div>

            <div class="layui-col-md4">
                <div class="layui-card">
                    <div class="layui-card-header">
                        <i class="iconfont icon-gonggao"></i>版本信息
                    </div>
                    <div class="layui-card-body layadmin-carousel layui-text" id="view">

                    </div>
                </div>
            </div>
             
            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header loading-more">
                        <div><i class="iconfont icon-dingdan1"></i>最近登录</div>
                        <a href="javascript:;" lay-href="{:url('OperationLog/userLog')}">查看更多>></a>
                    </div>

                    <div class="layui-card-body" id="loginLog"></div>

                </div>
            </div>

            <div class="layui-col-md6">
                <div class="layui-card">
                    <div class="layui-card-header loading-more">
                        <div><i class="iconfont icon-dingdan1"></i>操作日志</div>
                        <a href="javascript:;" lay-href="{:url('OperationLog/index')}">查看更多>></a>
                    </div>
                    <div class="layui-card-body" id="oplog-table"></div>
                </div>
            </div>

            <script id="demo" type="text/html">
                <table class="layui-table">
                    <tbody>
                        {{# for(var i = 0; i
                        < d.length; i++){ }} <tr>
                            <td><i>{{i+1}}</i><a class="notice" href="javascript:;" id="{{d[i].id}}">{{ d[i].title }}</a></td>
                            </tr>
                            {{# } }} {{# if(d.length === 0){ }} 没有最新的数据 {{# } }}
                    </tbody>
                </table>
            </script>


            <script id="log" type="text/html">

                {{# if(d.length === 0){ }} 没有历史记录 {{# }else{ }}
                <table class="layui-table">
                    <thead>
                        <tr>
                            <th>状态</th>
                            <th>操作员</th>
                            <th>记录时间</th>
                            <th>登录IP</th>
                        </tr>
                    </thead>
                    <tbody>
                        {{# layui.each(d, function(index, item){ }}
                        <tr>
                            <td>{{ item.state }}</td>
                            <td>{{ item.username }}</td>
                            <td>{{ item.ctime }}</td>
                            <td>{{ item.ip }}</td>
                        </tr>
                        {{# }); }}
                    </tbody>
                </table>
                {{# } }}
            </script>

            <script id="version" type="text/html">
                <table class="layui-table">
                    <colgroup>
                        <col width="100">
                        <col>
                    </colgroup>
                    <tbody>
                        <tr>
                            <td>产品名称</td>
                            <td style="height:25px">
                                {{ d.product }}
                            </td>
                        </tr>
                        <tr>
                            <td>当前版本</td>
                            <td style="height:25px">
                                {{ d.version }} <a target="_blank" style="padding-left: 15px;" style='float:right'>更新日志</a>
                            </td>
                        </tr>
                        <tr>
                            <td>是否授权</td>
                            <td style="height:25px">
                                {{# if(d.is_authorization ==true){ }}
                                <a style="color: green;" target="_blank">已授权</a> {{# }else{ }}
                                <a style="color: red;" target="_blank">未授权</a> {{# } }}
                            </td>
                        </tr>
                        <tr>
                            <td>到期时间</td>
                            <td style="height:25px">
                                {{ d.enddate }} 
                            </td>
                        </tr>
                    </tbody>
                </table>
            </script>

            <script id="oplog" type="text/html">

                {{# if(d.length === 0){ }} 没有操作记录 {{# }else{ }}
                <table class="layui-table">
                    <thead>
                        <tr>
                            <th style="width:80px">操作员</th>
                            <th style="width:140px">操作时间</th>
                            <th>操作内容</th>
                            <th>操作IP</th>
                        </tr>
                    </thead>
                    <tbody>
                        {{# layui.each(d, function(index, item){ }}
                        <tr>
                            <td>{{ item.username }}</td>
                            <td>{{ item.ctime }}</td>
                            <td>{{ item.desc }}</td>
                            <td>{{ item.ip }}</td>
                        </tr>
                        {{# }); }}
                    </tbody>
                </table>
                {{# } }}
            </script>

            <script type="text/javascript">
                layui.use(['laytpl', 'layer'], function() {
                    var $ = layui.$,
                        laytpl = layui.laytpl,
                        layer = layui.layer;
                    $.get("{:url('manage/administrator/getVersion')}", function(data) {
                        var getTpl = version.innerHTML,
                            view = document.getElementById('view');
                        laytpl(getTpl).render(data.data, function(html) {
                            view.innerHTML = html;
                        });
                    });

                    //获取历史登录记录
                    $.get("{:url('manage/User/userLogList',array('state'=>1))}", function(data) {
                        var getTpl = log.innerHTML,
                            view = document.getElementById('loginLog');
                        laytpl(getTpl).render(data.data, function(html) {
                            view.innerHTML = html;
                        })
                    });
                    JsGet("{:url('manage/OperationLog/getLastLog')}", function(data) {
                        var getTpl = oplog.innerHTML,
                            view = document.getElementById('oplog-table');
                        laytpl(getTpl).render(data.data, function(html) {
                            view.innerHTML = html;
                        })
                    });
                });
                // 路径配置
                require.config({
                    paths: {
                        echarts: '__STATIC_LIB__echarts/build/dist'
                    }
                });
                require(
                    ['echarts', 'echarts/chart/line'],
                    function(ec) {
                        var myChart = ec.init(document.getElementById('main'));
                        var option = {
                            // title: {
                            //     text: '最近7天充值/消费统计'
                            // },
                            tooltip: {
                                trigger: 'axis'
                            },
                            legend: {},
                            yAxis: [{
                                type: 'value',
                                name: '元'
                            }],
                            xAxis: [{
                                type: 'value',
                                name: '日期'
                            }],
                            series: []
                        };
                        $.get('{:url("BillPayments/statistics")}').done(function(data) {
                            myChart.setOption({
                                legend: data.legend,
                                xAxis: data.xAxis,
                                series: data.series
                            });
                        });
                        myChart.setOption(option);
                    }
                );
                require(
                    [
                        'echarts',
                        'echarts/chart/line' // 使用柱状图就加载bar模块，按需加载
                    ],


                    function(ec) {
                        // 基于准备好的dom，初始化echarts图表
                        var myChart = ec.init(document.getElementById('users'));

                        var option = {
                            // title: {
                            //     text: '最近7天新增/活跃用户统计'
                            // }, 
                            tooltip: {
                                trigger: 'axis'
                            },
                            legend: {},
                            yAxis: [{
                                type: 'value',
                                name: '人'
                            }],
                            xAxis: [{
                                type: 'value',
                                name: '日期'
                            }],
                            series: []
                        };
                        $.get('{:url("user/statistics")}').done(function(data) {
                            myChart.setOption({
                                legend: data.legend,
                                xAxis: data.xAxis,
                                series: data.series
                            });
                        });
                        // 为echarts对象加载数据
                        myChart.setOption(option);
                    }
                );
            </script>
        </div>
</div>
<style>
    .loading-more {
        overflow: hidden;
    }
    
    .loading-more>div {
        display: inline-block;
    }
    
    .loading-more a {
        float: right;
        font-size: 12px;
        margin-top: 5px;
    }
</style>